import request from '../../utils/request';
import empUrl from '../urls/emp'


//增加员工表信息
export const addEmp = data => {
    return request({
        headers: {
            "Content-Type": "application/json"
        },
        url: empUrl.addEmpUrl,
        method: 'post',
        data: data
    });
};

//获取部门员工信息（部门id,部门姓名,员工id,员工姓名，岗位id,岗位名称）
export const fetchEmpOfTran = data => {
    return request({
        url: empUrl.fetchEmpOfTranUrl,
        method: 'get',
        params: data
    });
};

//更新员工的部门id
export const updateEmpDeptId = data => {
    return request({
        headers: {
            "Content-Type": "application/json"
        },
        url: empUrl.updateDeptIdUrl,
        method: 'post',
        data: data
    });
};

//更新员工的岗位id
export const updateEmpStatId = data => {
    return request({
        headers: {
            "Content-Type": "application/json"
        },
        url: empUrl.updateStatIdUrl,
        method: 'post',
        data: data
    });
};

//更新员工表的类型
export const updateForm = data => {
    return request({
        headers: {
            "Content-Type": "application/json"
        },
        url: empUrl.updateFormUrl,
        method: 'post',
        data: data
    });
};

//获取员工表的所有信息
export const fetchEmp = (data) => {
    return request({
        url: empUrl.fetchEmpUrl,
        method: 'get',
        params: data
    });
};

//更新员工表
export const updateEmp = (data) => {
    return request({
        headers: {
            "Content-Type": "application/json"
        },
        url: empUrl.updateEmpUrl,
        method: 'post',
        data: data
    });
};

//统计新聘员工报表，根据开始和结束时间段进行条件查询
export const fetchEmpByTime = (data) => {
    return request({
        url: empUrl.fetchEmpByTimeUrl,
        method: 'get',
        params: data
    });
};

//统计该公司人员的性别
export const countEmpSex = () => {
    return request({
        url: empUrl.countEmpSexUrl,
        method: 'get',
    });
};


//统计近5个月的部门新增和离职的人数
export const countEmp = () => {
    return request({
        url: empUrl.countEmpUrl,
        method: 'get',
    });
};
    

